package com.foreknow.elmboot.service;

import com.foreknow.elmboot.po.Cart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface CartService {

    /**
     * 向购物车中添加数据
     * @param foodId
     * @param businessId
     * @param userId
     * @return
     * @throws Exception
     */
    public int saveCart(Integer foodId,Integer businessId,Integer userId)throws Exception;

    /**
     * 更新数量
     * @param foodId
     * @param businessId
     * @param userId
     * @param quantity
     * @return
     * @throws Exception
     */
    public int updateCart(Integer foodId,Integer businessId,Integer userId,Integer quantity) throws Exception;

    /**
     * 查询购物车中的菜品
     * @param businessId
     * @param userId
     * @return
     * @throws Exception
     */
    public List<Cart> listCart(Integer businessId, Integer userId) throws Exception;

    /**
     * 删除购物车菜品
     * @param cartId
     * @return
     * @throws Exception
     */
    public int deleteCart(Integer cartId) throws Exception;

    /**
     * 查询菜品ID
     * @param foodId
     * @param businessId
     * @param userId
     * @return
     * @throws Exception
     */
    public int selectCartId(Integer foodId,Integer businessId,Integer userId) throws Exception;
}
